export default function (app, inject) {
    //配置公共路径
    app.$axios.defaults.baseURL = 'http://localhost:5000'
    //接口配置
    const _API = {

        //获取导航菜单 /api/classify
        getClassify: () => app.$requestApi({
            url: '/api/classify',
        }),

        //获取文章列表 /api/article
        getArticle: (data) => app.$requestApi({
            url: '/api/article',
            method: 'post',
            data
        }),

        //获取页码内容标题 /api/contenttitle
        getContentTitle: (data) => app.$requestApi({
            url: '/api/contenttitle',
            method: 'post',
            data
        }),

        //获取文章内容 /api/content-article
        getContentArticle: (data) => app.$requestApi({
            url: '/api/content-article',
            method: 'post',
            data: { ...data, publish: true }
        }),

        //登录 /api/login
        getLogin: (data) => app.$requestApi({
            url: '/api/login',
            method: 'post',
            data
        }),

        //获取图片链接Host /api/filesHost
        filesHost: () => app.$requestApi({
            url: '/api/filesHost'
        }),

        //账号设置 - 基本资料 - 修改 /api/updateUserInfo
        updateUserInfo: (data) => app.$requestApi({
            url: '/api/updateUserInfo',
            method: 'post',
            data
        }),

        //账号设置 - 电子邮箱 - 修改 /api/updateEmail
        updateEmail: (data) => app.$requestApi({
            url: '/api/updateEmail',
            method: 'post',
            data
        }),

        //账号设置 - 修改密码 /api/updatePassword
        updatePassword: (data) => app.$requestApi({
            url: '/api/updatePassword',
            method: 'post',
            data
        }),

        //设置上传头像图片
        uploadAvatar: (data) => app.$requestApi({
            url: '/api/uploadAvatar',
            method: 'post',
            data
        }),

        //获取评论数据 /api/comment
        getComment: (data) => app.$requestApi({
            url: '/api/comment',
            method: 'post',
            data
        }),

        //获取评论列表 /api/commentList
        getCommentList: () => app.$requestApi({
            url: '/api/commentList',
        }),

        //添加评论数据 /api/addComment
        addComment: (data) => app.$requestApi({
            url: '/api/addComment',
            method: 'post',
            data
        }),

        //添加和取消 点赞、收藏、关注 /api/likeCollect
        likeCollect: (data) => app.$requestApi({
            url: '/api/likeCollect',
            method: 'post',
            data
        }),

        //获取其他用户信息 /api/OtherUser
        getOtherUser: (data) => app.$requestApi({
            url: '/api/OtherUser',
            method: 'post',
            data
        }),


        //获取其他用户评论信息 /api/otherComment
        getOtherComment: (data) => app.$requestApi({
            url: '/api/otherComment',
            method: 'post',
            data
        }),

        //获取其他用户收藏文章列表 - 前端 /api/otherCollect
        getOtherCollect: (data) => app.$requestApi({
            url: '/api/otherCollect',
            method: 'post',
            data
        }),
    }
    //注入到全局nuxt示例中
    inject('api', _API)



}